package model;
import java.util.ArrayList;
import java.io.*;

public class Arrive {
    ArrayList<Edge> _edges = new ArrayList<Edge>();
    Node _node;
    Edge _edge;
    
    String _name;
    String _stateChanges;
    String _nodeDescription;
    String _parameters;
    
    String _edgeDescription;
    String _endNodeName;
    String _condition;
    String _delay;
    String _priority;
    String _attributes;
    
    public Arrive(int totalNumOfPatientTypes) {
        makeNode(totalNumOfPatientTypes);
    }
    
    public void makeNode(int totalNumOfPatientTypes) {
        /*
         * Make the node
         */
        _name = "ARRIVE";
        _nodeDescription = "";
        _stateChanges = "PID=PID+1,ENT[0]=PID,ENT[1]=CLK,ENT[2]=DISK{PATIENT.DAT;PDATA*(PTYPE-1)+3},ENT[3]=PTYPE,ENT[4]=0,ENT[5]=DISK{PATIENT.DAT;PDATA*(PTYPE-1)+4},QT=QT+PUT{INC;ENT[5]}";
        _parameters = "PTYPE";
        
        _node = new Node(_name, _nodeDescription, _stateChanges, _parameters);
        
        /*
         * ARRIVE -> SORT
         */
        _edgeDescription = "";
        _endNodeName = "SORT";
        _condition = "1==1";
        _delay = "0";
        _priority = "";
        _attributes = "ENT[5]";
        
        _edge = new Edge(_edgeDescription, _name, _endNodeName, _condition, _delay, _priority, _attributes);
        _edges.add(_edge);
        
        /*
         * ARRIVE -> ARRIVE
         */
        _edgeDescription = "";
        _endNodeName = "ARRIVE";
        _condition = "1==1";
        _delay = "DISK{PATIENT.DAT;PDATA*(PTYPE-1)+2}";
        _priority = "";
        _attributes = "PTYPE";
        
        _edge = new Edge(_edgeDescription, _name, _endNodeName, _condition, _delay, _priority, _attributes);
        _edges.add(_edge);
    }
    
    public void outputNode() {
        
    }
    
    public void outputEdge() {
        
    }
}
